package com.rn.ddd.application.service.impl;

import com.rn.ddd.application.service.OrderAppService;
import com.rn.ddd.domain.order.event.CreateOrderEvent;
import com.rn.ddd.infrastructure.engine.OrderEngine;
import com.rn.ddd.domain.order.entity.OrderDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 订单应用层服务接口实现
 *
 * @author 然诺
 * @date 2022/3/26
 */
@Service
public class OrderServiceImpl implements OrderAppService {

    @Autowired
    private OrderEngine orderEngine;

    @Override
    public long createOrder(OrderDO orderDO) {
        try {
            orderEngine.sendEvent(new CreateOrderEvent(), orderDO);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return 0;
    }

}
